﻿@using ReportViewerForMvc;
@using Apps.Web.Core;
@using Apps.Locale;
@using System.Data; 
@model DataTable
@{
    ViewBag.Title = "自采煤台账";
    Layout = "~/Views/Shared/_Index_Layout.cshtml";
}
<script src="~/Scripts/My97DatePicker/WdatePicker.js"></script>
<script src="~/Scripts/common.js"></script>
<form id="form1">
    <div class="mvctool">
        <select class="easyui-combobox" name="TYPE_ID" id="TYPE_ID" style="width:250px;"></select>
        <input type="text" class="input Wdate" style="width:105px" name="STime" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd', maxDate: '#F{$dp.$D(\'ETime\')}' })" id="STime" value="@ViewBag.STime" placeholder="开始日期">
        <input type="text" class="input Wdate" style="width:105px" name="ETime" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd', minDate: '#F{$dp.$D(\'STime\')}' })" id="ETime" value="@ViewBag.ETime" placeholder="结束日期">
        @Html.ToolButton("btnQuery", "fa fa-search", Resource.Query, "Query", true)
        @Html.ToolButton("btnExport", "fa fa-print", "打印", "Query", true)
    </div>
</form>
 
<div id="modalwindow"  style="width:100%; height:600px;"  ></div>

<script type="text/javascript">

    function changeFrameHeight() {
        var ifm = document.getElementById("iframeMain");
        if (ifm != null)
        ifm.height = document.documentElement.clientHeight-50;
    }
    $(function () {
        bindCommbox();
    });

    function bindCommbox() {
        $.ajax({
            url: '../../RC/SAMPLING/GetTranSuppList?type=4',
            type: 'post',
            dataType: 'json',
            success: function (result) {
                $('#TYPE_ID').combobox({
                    data: result,
                    valueField: 'Value',
                    textField: 'Text',
                    onLoadSuccess: function () {

                    }
                });
            },
        });
    }

    $("#btnQuery").click(function () {
       //$("#form1").submit();
        
        let TYPE_ID = $("#TYPE_ID").combogrid('getValue');
        let STime = $("#STime").val();
        let ETime = $("#ETime").val();
        
        //if (TYPE_ID == null || TYPE_ID == undefined || TYPE_ID == '')
        //{
        //    $.messageBox5s(Lang.Tip, '请选择类型');
        //    return;
        //}
        $("#modalwindow").html("<iframe id='iframeMain' width='100%' height='99%' frameborder='0' src='@Url.Action("ReportChild")?TYPE_ID=" + TYPE_ID + "&TRANSPORT_ID=&STime=" + STime + "&ETime=" + ETime+"'></iframe>");
        changeFrameHeight();
    });
    $("#btnExport").click(function () {
        //if (TYPE_ID == null || TYPE_ID == undefined || TYPE_ID == '') {
        //    alert('请选择类型');
        //    return;
        //}
        $("#iframeMain")[0].contentWindow.printpage();

    });
</script>

<style media="print">
   @("@")
    page {
        size: auto; /* auto is the initial value */
        margin: 0mm; /* this affects the margin in the printer settings */
        size: portrait;
    }

    .divContent {
        margin: 5px;
        width: 100%;
        text-align: center;
        /* transform: scale(0.9);
        -webkit-transform: scale(0.8);*/
    }

    table.gridtable {
        margin: 0 auto;
        width: 100%;
        font-family: verdana, arial, sans-serif;
        font-size: 11px;
        color: #333333;
        border-width: 1px;
        border-color: #666666;
        border-collapse: collapse;
    }

        table.gridtable th {
            border-width: 1px;
            padding: 2px;
            border-style: solid;
            border-color: #666666;
            background-color: #dedede;
        }

        table.gridtable tr {
            margin-top: 2px;
        }

        table.gridtable td {
            border-width: 1px;
            padding: 2px;
            border-style: solid;
            border-color: #666666;
            background-color: #ffffff;
            text-align: center;
            font-size: 24px;
        }

    .divBottom {
        /*border-bottom: 1px solid #666666;*/
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
    }

    .font10 {
        font-size: 12px;
        transform: scale(0.8);
    }

    .headImg {
        width: 78px;
        height: 97px;
    }
</style>